<script type="text/javascript" src="ccay/example/demo.js"
	charset="utf-8"></script>
<script type="text/javascript" src="ccay/example/special/igrid.js"
	charset="utf-8"></script>
<link rel="stylesheet" href="ccay/example/demo.css"
	type="text/css" />
<style type="text/css">
h5 {
	font-size: 13px;
	font-weight: normal;
	line-height: 23px;
	float: right;
}

h6 {
	font-size: 13px;
	color: red;
	float: left;
	line-height: 13px;
}

.showClew {
	font-size: 13px;
	color: olive;
}

.showClew span {
	color: peru;
}

.spanShow {
	color: peru;
}

.s_title {
	font-size: 14px;
	color: red;
	margin: 4px 0px;
	display: block;
}

pre,xmp {
	margin: 0px;
	padding: 0px;
}

.code_size {
	font-size: 14px;
}

div.try{padding-bottom:30px;}
div.try a{cursor:pointer;}
</style>
<div id="specialDemoTab">
	<div title="案例">
		<h4>
			<span>场景一：编辑完后，直接点击保存，未获取到最新数据。</span>
		</h4>
		<span class="showClew">说明：用户自定义的保存方法，当用户编辑数据后，直接点击保存，获取不到最新数据。</span>
		<span class="s_title">解决办法：在获取数据之前，结束下编辑。代码如下：</span>
		<pre class="code_size">
JS:
<span id="specialIgrid_01_JS">
  _save = function(){
  	var grid = $("#gridS1").manager();
  	//第一种方式，使用endEdit结束编辑，如果当前版本不支持endEdit，可以使用第二种方式
  	grid.endEdit();
  	//第二种方式
	var activeEditor = grid.getActiveEditor() || [];
	$.each(activeEditor,function(i,editor){
		Ccay.UI.IGrid.Editor.endEdit(editor,grid,grid.op);
	});
	grid.clearActiveEditor();
	grid.getUpdatedRecords()//这样才能获取到最新数据。
  }
  var dataS1 = [{name:"t1",sex:1},{name:"t2",sex:0}];
  var gridOptionS1 = {
	height: 347,
	editMode:true,
	columns: [
	  {field: 'name', width:70, header: "string"},
	  {field: 'sex', width:50, header: "bool", type: 'bool', format:{htmlView: true}}
	]
  };
  $("#gridS1").igrid(gridOptionS1,dataS1);
</span>
HTML:
<xmp id="specialIgrid_01_Html">
  <input type="button" value="save" onclick="_save()" />
  <div id="gridS1"></div>
</xmp>
</pre>
		<div class="try">
			<a
				onclick="Ccay.example.openTry('#specialDemoTab',$('#specialIgrid_01_JS').html(),$('#specialIgrid_01_Html').html())">亲自试一试</a>
		</div>
	</div>
	<div title="试一试" tabid="trytab">
		<fieldset class='ccay-demo'>
			<legend>
				<h2>代码区</h2>
			</legend>

			<span>请在下面的文本框中编辑您的代码，然后单击此按钮测试结果 ————></span><input
				value="try it yourself" type="button"
				onclick="Ccay.example.runDemo()" />

			<div>
				<table style="width: 100%;">
					<tr>
						<td style="width: 100%;">
							<h3>js Code:</h3> <!-- 高度按需来调整。默认最小应为100px --> <textarea
								id="jsTxt" style="height: 150px; width: 99%;"></textarea>
						</td>
					</tr>
					<tr>
						<td style="width: 100%;">
							<h3>html Code:</h3> <!-- 高度按需来调整。默认最小应为100px --> <textarea
								id="htmlTxt" style="height: 150px; width: 99%;"></textarea>
						</td>
					</tr>
				</table>
			</div>
		</fieldset>
		<fieldset class='ccay-demo'>
			<legend>
				<h2>结果区</h2>
			</legend>
			<div>
				<div style="overflow: auto;" id="demoMainPanel"></div>
			</div>
		</fieldset>
	</div>
</div>